package game;


public class Case
{

        public static final int NORMAL=1;
        public static final int LDOUBLE=2;
        public static final int LTRIPLE=3;
        public static final int MDOUBLE=5;
        public static final int MTRIPLE=6;
       
private Jeton j;
private int x,y;
private int type;
private boolean use;


       
        /**Constructors
         * constructeurs d'une case
         * @param x coord X 
         * @param y coord Y
         * @param t type de la case(McT,LcD,...)
         */
Case(int x,int y,int t)
{
        j=null;
        this.x=x;
        this.y=y;
        type=t;
        use=false;

}


//Getters
public Jeton GetJeton(){return j;}
public int GetX(){return x;}
public int GetY(){return y;}
public int GetType(){return type;}
public boolean GetUse(){return use;}


//Setters
public void SetJeton(Jeton j){this.j=j;}
public void SetX(int a){x=a;}
public void SetY(int b){x=b;}
public void SetType(int t){type=t;}
public void SetUse(boolean b){use=b;}




public String toString()
{
        String s;
        if(j!=null)s=j.toString();
        else
        {
        switch (this.type)
        {
        case NORMAL:
                s="   ";
                break;
        case LDOUBLE:
                s="LcD";
                break;
        case LTRIPLE:
                s="LcT";
                break;
        case MDOUBLE:
                s="McD";
                break;
        case MTRIPLE:
                s="McT";
                break;
        default:s="***";
        }
       
               
        }
        return s;
}


/**verifie si la case contient un jeton
 * @return si la case contient un jeton
 */
public boolean hasJeton() {
	boolean res;
	if(j==null) res=false;
	else return true;
	return res;
}


/**regarde si la case est une case MTRIPLE ou MDOUBLE qui pourrait donner un bonus multiplicateur au mot
 * @return le bonus multiplicateur de mot
 */
public int getMulti() {
	int res=1;
	if (type==MDOUBLE )res=2;
	else if( type==MTRIPLE) res=3;
	return res;
}

/**regarde si la case est une case LTRIPLE ou LDOUBLE qui pourrait donner un bonus multiplicateur au mot
 * @return le bonus multiplicateur de la lettre
 */
public int getNbPoints(Jeton lettre) {
	int res=1;
	if(type==LDOUBLE || type==LTRIPLE) res=type;
	
	return res;
}

}
